package cn.cs.service;

import cn.cs.common.Page;
import cn.cs.mapper.AppSettlementMapper;
import cn.cs.pojo.AppSettlement;
import org.apache.ibatis.annotations.Param;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;


@RestController
public class AppSettlementService {

    @Resource
    private AppSettlementMapper appSettlementMapper;

    @RequestMapping(value = "/getAppSettlementById", method = RequestMethod.POST)
    public Map<String, String> getAppSettlementById(@RequestParam("id") String id) throws Exception{
        return appSettlementMapper.getAppSettlementById(id);
    }

    @RequestMapping(value = "/getAppSettlementListByMap", method = RequestMethod.POST)
    public List<AppSettlement> getAppSettlementListByMap(@RequestBody Map<String, Object> param) throws Exception{
        return appSettlementMapper.getAppSettlementListByMap(param);
    }

    @RequestMapping(value = "/getAppSettlementCountByMap", method = RequestMethod.POST)
    public Integer getAppSettlementCountByMap(@RequestBody Map<String, Object> param) throws Exception{
        return appSettlementMapper.getAppSettlementCountByMap(param);
    }

    @RequestMapping(value = "/addAppSettlement", method = RequestMethod.POST)
    public Integer addAppSettlement(@RequestBody AppSettlement appSettlement) throws Exception{
        return appSettlementMapper.insertAppSettlement(appSettlement);
    }

    @RequestMapping(value = "/modifyAppSettlement", method = RequestMethod.POST)
    public Integer modifyAppSettlement(@RequestBody AppSettlement appSettlement) throws Exception{
        return appSettlementMapper.updateAppSettlement(appSettlement);
    }

    @RequestMapping(value = "/deleteAppSettlementById", method = RequestMethod.POST)
    public Integer deleteAppSettlementById(@RequestParam("id") String id) throws Exception{
        return appSettlementMapper.deleteAppSettlementById(id);
    }

    @RequestMapping(value = "/updateAppSettlementState", method = RequestMethod.POST)
    public Integer updateAppSettlementState(@Param("id")String id, @Param("personId")String personId)throws Exception{
        return appSettlementMapper.updateAppSettlementState(id, personId);
    }
}
